php get string after character

63

php get string after character -

$data = "123_String";    
$whatIWant = substr($data, strpos($data, "_") + 1);    
echo $whatIWant;

get words after string in in php -

$string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla felis diam, mattis id elementum eget, ullamcorper et purus.";
$prefix = "Nulla";
$index = strpos($string, $prefix) + strlen($prefix);
$result = substr($string, $index);

Comments

Submit
0 Comments